package com.le.tester.book.effectivejava3rdchinese.articleone;

/**
 * createTime：2022/7/28 10:14
 * description：静态工厂方法和类构造方法，在工具类中应用特别的明显，只是不显示的new一个对象，本质上就是为new包装了一层static,
 * 增加于代码的可读取性
 *
 */
public class Gender {


    private String description;

    //final对象
    private static final Gender female = new Gender("女");

    private static final Gender male = new Gender("男");

    public Gender(String description) {
        this.description = description;
    }

    private String getDescription() {
        return description;
    }

    private static Gender getFemale() {
        return female;
    }

    private static Gender getMale() {
        return male;
    }

    public static void main(String[] args) {
       // Integer.valueOf()
        Gender female = Gender.getFemale();

    }
}
